<?php
// +----------------------------------------------------------------------
// | KITEGO-Admin「开箱即用」「人人全栈」
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2024 https://www.kitego.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed KITEGO并不是自由软件，未经许可不能去掉KITEGO相关版权
// +----------------------------------------------------------------------
// | Author: KITEGO Team <bd@kitego.cn>
// +----------------------------------------------------------------------

namespace kitego\enums;

use ReflectionClass;

final class AttachmentCategoryEnum
{
    private function __construct() {} // 防止实例化

    const IMAGE = '1'; // 图片
    const VIDEO = '2'; // 视频
    const FILE = '3'; // 文件

    public static function all(): array
    {
        $reflection = new ReflectionClass(__CLASS__);

        return $reflection->getConstants();
    }

    public static function key($value): int|string
    {
        $keyName = array_search($value, self::all());

        return $keyName !== false ? $keyName : '';
    }
}